<template>

  <div class=" ">
    <div>直播中活动</div>
    <div  v-for="(item, i) in runProjects" class="oneProjectDiv" style="padding: 10px; margin-top: 10px;" @click="goPageA" >
      <div style="display: inline-block; background-color: red; width: 40%; height: 100px; padding:0px; float: left" class="" >
        <img :src="swiperImgs[0].img" style="height:100%; width: 100%; margin: 0px;padding:0px;"  />
      </div>
      <div style="display: inline-block;  width: 50% ; padding: 5px;">
        <div style="margin-bottom: 5px; font-size: 16px;">活动标题标题标题</div>
        <div  style="margin-top: 10px; font-size: 14px;">活动描述描述述描述述描述述描述述描述</div>
      </div>
    </div>

  </div>
</template>

<script>

  import { Marquee, MarqueeItem , Swiper ,Search ,Checker, CheckerItem } from 'vux'

  export default {
    components: {  Marquee,  MarqueeItem  ,Swiper  ,Search  , Checker, CheckerItem},
    name: 'ProjectList',
    data () {
      return {
        pid : 1 ,
        msg : 'MSSSGGG',
        baseUrl: process.env.BASE_URL,
        runProjects:[
          { proId:1 , proTitle:"活动标题1111"  },
          { proId:2 , proTitle:"活动标题我十一2"  },
          { proId:3 , proTitle:"活动标题333"  },
          { proId:4 , proTitle:"活动标题444"  },
        ],
        swiperImgs:[
          {
            proId:1 ,
            url: 'http://www.baidu.com',
            img: process.env.BASE_URL +'/resources/photo/1.jpg',
            title: '送你一朵fua1'
          },
          {
            proId:2 ,
            url: 'javascript:',
            img: process.env.BASE_URL +'/resources/photo/2.jpg',
            title: '送你一朵fua2'
          },
          {
            proId:3 ,
            url: 'javascript:',
            img: process.env.BASE_URL +'/resources/photo/3.jpg',
            title: '送你一朵fua3'
          },
        ],
        swiperIndex : 0,
        proTypeSelect : [],
        sresults :[
          {title: 'hello', otherData: 'otherValue' },
          {title: 'hello2', otherData: 'otherValue' },
          {title: 'hello3', otherData: 'otherValue' },
        ],
        searchKey : "",
        table : {
          total : 1 ,
          current : 0 ,
          pageSize : 18 ,
          isGetActive : true,
        },
      }
    },
    methods: {
      goProjectByID( proId ){
        console.log(  "  proId : " + proId );
      },
      goPageA () {
        let vm = this;
        this.$router.push({ name: 'ViewProject', query: { pid: vm.pid , showCover : false }    })

      },
      getProjects(){
        let vm = this;
        if ( vm.table.current >=  vm.table.total ) {
          return ;
        }
        let path = "guest/getPros";
        vm.$http.get( path , {
            params: {
              current : vm.table.current,
              pageSize : vm.table.pageSize,
              isGetActive : vm.table.isGetActive,
            }
          }
        ).then(function (response) {
          if (response.data.result) {

            console.log( response.data );
            vm.table.total = response.data.total;
            vm.table.current = response.data.current;
            // vm.table.isGetActive = false;

          }
        }).catch(function (error) {
          console.log(error)
        })

      },

      postCase() {
        let vm = this;
        let path = "guest/test2";
        let params = new FormData();
        params.append("pid", vm.pid );
        vm.$http.post(path, params)
          .then(function (response) {
            console.log(response.data);
            if (response.data.result) {

            } else {
            }
          }).catch(function (error) {
          console.log(error)
        });
      },
      getCase() {
        let vm = this;
        let path = "guest/test2";
        vm.$http.get(path, {
            params: {
              "pid": vm.pid
            }
          }
        ).then(function (response) {
          if (response.data.result) {
            console.log(response.data);
          }
        });
      },
    },
    created () {

    },
    mounted(){
      this.getProjects();
    },
  }
</script>

<style scoped>

</style>
